import { SELECT, CRUD } from '@/sheep/request/crud';
import { request } from '@/sheep/request';

const route = {
  path: 'dispatch',
  name: 'shop.admin.supply.dispatch',
  component: () => import('./index.vue'),
  meta: {
    title: '配送',
  },
};

const api = {
  ...CRUD('shop/admin/dispatch/dispatch', ['list', 'add', 'edit']),
  detail: (id, params) =>
    request({
      url: `shop/admin/dispatch/dispatch/${id}`,
      method: 'GET',
      params,
    }),
  delete: (id, params) =>
    request({
      url: `shop/admin/dispatch/dispatch/${id}`,
      method: 'DELETE',
      options: {
        showSuccessMessage: true,
      },
      params
    }),
  select: (params) => SELECT('shop/admin/dispatch/dispatch', params),
};

export { route, api };
